﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SSISPackageExplorer.UI
{
    public partial class PackageEdit : Form
    {
        public PackageEdit(PackageNode packageNode)
        {
            InitializeComponent();
            this.PackageNode = packageNode;
        }

        public PackageNode PackageNode { get; set; }

        private void OkButton_Click(object sender, EventArgs e)
        {
            this.PackageNode.NodeFont = this.SampleTextBox.Font;
            this.PackageNode.ForeColor = this.SampleTextBox.ForeColor;
            this.PackageNode.BackColor = this.SampleTextBox.BackColor;
            this.DialogResult = DialogResult.OK;
        }

        private void PackageEdit_Load(object sender, EventArgs e)
        {
            this.NoteTextBox.Text = "Notes About " + this.PackageNode.Text;
            this.SampleTextBox.Font = this.PackageNode.NodeFont;
            this.SampleTextBox.ForeColor = this.PackageNode.ForeColor;
            this.SampleTextBox.BackColor = this.PackageNode.BackColor;
            this.SampleTextBox.Text = this.PackageNode.Text;
        }

        private void FontButton_Click(object sender, EventArgs e)
        {
            FontDialog f = new FontDialog();
            if (f.ShowDialog() == DialogResult.OK)
            {
                this.SampleTextBox.Font = f.Font;            
            }
        }

        private void ForeColorButton_Click(object sender, EventArgs e)
        {
            ColorDialog c = new ColorDialog();
            if (c.ShowDialog() == DialogResult.OK)
            {
                this.SampleTextBox.ForeColor = c.Color;
            }
        }

        private void BackButton_Click(object sender, EventArgs e)
        {
            ColorDialog c = new ColorDialog();
            if (c.ShowDialog() == DialogResult.OK)
            {
                this.SampleTextBox.BackColor = c.Color;
            }
        }
    }
}
